
public class TimeManager {
	int roundCounter;
	int minute, hour, day, dayOfWeek;
	String dayText,timeOfDay;
	
	public TimeManager(){
		roundCounter = 0;
		minute = 3;
		hour = 17;
		day = 1;
		dayOfWeek = 2;
		dayText = getDay();
		timeOfDay = timeOfDay();
	}
	
	public void turn(){
		roundCounter++;
	}
	
	public int getRound(){
		return roundCounter;
	}
	
	public String getDay(){
		switch(dayOfWeek){
			case 0:
				return "Sunday";
			case 1:
				return "Monday";
			case 2:
				return "Tuesday";
			case 3:
				return "Wednesday";
			case 4:
				return "Thursday";
			case 5:
				return "Friday";
			case 6:
				return "Saturday";
			default:
				return "Unknown";
		}		
	}
	
	public void increaseMinutes(int minutes){
		int temp = minute + minutes;

		if(temp > 59){
			minute = temp % 60;
			increaseHours(1);
		}
		else{
			minute = temp;
		}	
	}
	
	public void increaseHours(int hours){
		int temp = hour + hours;
		
		if(temp > 23){
			hour = temp % 24;
			increaseDays(1);
		}
		else{
			hour = temp;
		}
	}
	
	public void increaseDays(int days){
		int temp = day + days;
		
		if(temp > 6){
			day = temp % 7;
			increaseDays(1);
		}
		else{
			day = temp;
		}
	}
	
	public String timeOfDay(){
		if(hour >= 0 && hour < 12)
			return "morning";
		else if(hour >= 12 && hour < 17)
			return "afternoon";
		else
			return "evening";
	}
	
	public String toString(){
		return "It is " + convertHour() + ":" + convertMinute() + " in the " + timeOfDay + " on " + dayText;
	}
	
	public String convertMinute(){
		String minuteText = Integer.toString(minute);
		if(minuteText.length() == 1){
			minuteText = "0" + minuteText;
		}
		
		return minuteText;
	}
	
	public String convertHour(){
		String hourText = Integer.toString(hour);
		
		if(hour == 0 || hour > 12)
		{	
			switch(hour){
				case 0:
					hourText = "12";
					break;
				case 13:
					hourText = "1";
					break;
				case 14:
					hourText = "2";
					break;
				case 15:
					hourText = "3";
					break;
				case 16:
					hourText = "4";
					break;
				case 17:
					hourText = "5";
					break;
				case 18:
					hourText = "6";
					break;
				case 19:
					hourText = "7";
					break;
				case 20:
					hourText = "8";
					break;
				case 21:
					hourText = "9";
					break;
				case 22:
					hourText = "10";
					break;
				case 23:
					hourText = "11";
					break;
			}	
		}
			
		return hourText;
	}
}
